<template>
	<view>
		<view style="padding-left: 20rpx;" v-if="detail.safetyExaminationType!=4">
			<p style="font-size: 60rpx;font-weight: 900;">{{detail.safetyExaminationName}}</p>
			<p style="font-size: 50rpx;margin-top: 10rpx;">开始时间：{{detail.startTime}}</p>
			<p style="font-size: 50rpx;margin-top: 10rpx;">结束时间：{{detail.finishTime}}</p>
			<p style="font-size: 50rpx;margin-top: 10rpx;">本次奖品：{{detail.prizeName[0]}}</p>
			<p v-for="(item,i) in detail.prizeName" v-if="i>0" style="font-size: 50rpx;margin-top: 10rpx;text-indent:5em;">{{item}}</p>
		</view>
		<view style="padding-left: 20rpx;" v-else-if="detail.safetyExaminationType==4">
			<p style="font-size: 60rpx;font-weight: 900;">暂无考试</p>
			<p style="font-size: 50rpx;margin-top: 10rpx;">开始时间：考试未开始</p>
			<p style="font-size: 50rpx;margin-top: 10rpx;">结束时间：考试未开始</p>
			<p style="font-size: 50rpx;margin-top: 10rpx;">本次奖品：考试未开始</p>
		</view>
		<view v-if="detail.safetyExaminationType==0">
			<button class="button-demo" >考试未开启</button>
		</view>
		<view v-else-if="detail.safetyExaminationType==1&&detail.examinationStatus==2">
			<button class="button-demo" @click="totest(detail.safetyExaminationId)">开始考试</button>
		</view>
		<view v-else-if="detail.safetyExaminationType==1&&detail.examinationStatus==0">
			<button class="button-demo" @click="totest(detail.safetyExaminationId)">继续考试</button>
		</view>
		<view v-else-if="detail.safetyExaminationType==1&&detail.examinationStatus==1">
			<button class="button-demo" @click="tozzz(detail.safetyExaminationId)">已完成考试</button>
		</view>
		<view v-else-if="detail.safetyExaminationType==2">
			<button class="button-demo" >考试已结束</button>
		</view>
		<view v-else-if="detail.safetyExaminationType==3">
			<button class="button-demo" >考试未开始</button>
		</view>
		<view v-else-if="detail.safetyExaminationType==4">
			<button class="button-demo" >暂无考试</button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				detail: {
					tsetid: '',
					name: '暂无考试',
					stime: '考试未开始',
					etime: '考试未开始',
					prize:'考试未开始'
				}
			}
		},
		onLoad: function(option) {
			this.$u.api.selectexaminationinfo({
				studentId:getApp().globalData.studentId
			}).then(res => {
				this.detail=res.rows[0];
				console.log(this.detail);
			})
		},
		methods: {
			totest(testid){
				uni.navigateTo({
					url: '/pages/examination/subject?testid='+testid,
				})
			},
			tozzz(eid){
				uni.navigateTo({
					url: '/pages/examination/exam_end?examinationId='+eid,
				})
			}
		}
	}
</script>

<style>
	.button-demo{
		width: 300rpx;
		height: 300rpx;
		border-radius: 150rpx 150rpx 150rpx 150rpx;
		background-color: #849bf3;
		color: #ffffff;
		margin-top: 250rpx;
		font-size: 50rpx;
		line-height:280rpx;/*针对IE*/
	}
</style>
